package com.gml.design.other.singleton;

/**
 * @ClassName : SIngleton08
 * @Description : 枚举单例
 *  不仅可以解决线程安全，还可以防止反序列化
 * @Author : gml
 * @Date: 2021-04-01 18:06
 */
public enum Singleton08 {

    INSTANCE;

    public void say(){

    }

    public static void main(String[] args) {
        for (int i = 0; i < 100; i++) {
            new Thread(()->{
                System.out.println(Singleton08.INSTANCE.hashCode());
            }).start();
        }
    }

}
